/**
 * @filename:LocationServiceImpl Jan 14, 2025
 * @project Wonder Vue Admin Api  1.1.0
 * Copyright(c) 2022 Wonder Co. Ltd. 
 * All right reserved. 
 */
package com.wonder.app.service.impl;

import com.wonder.app.domain.Location;
import com.wonder.app.domain.Material;
import com.wonder.app.mapper.LocationDao;
import com.wonder.app.service.LocationService;
import com.wonder.app.request.LocationRequest;
import com.wonder.common.utils.StringUtils;
import com.wonder.common.utils.MessageUtils;
import com.wonder.common.common.AjaxResult;
import java.util.Map;
import java.util.HashMap;
import java.util.List;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

/**   
 * @Description:TODO(仓位列表服务实现)
 *
 * @version: 1.1.0
 * @author: Wonder
 * 
 */
@Service
public class LocationServiceImpl  extends ServiceImpl<LocationDao, Location> implements LocationService  {

    /**
     * 验证仓位列表信息
     * 
     * @param location
     * @param type
     * @return String
     */
    @Override
    public String validate(Location location,String type){
    
    
       return "";
    }
    
    
    /**
	 * Description:仓位列表分页返回
	 * @param request //检索条件
	 * @param page //分页参数
	 * @return IPage<Location>   //分页记录
	 */
	@Override 
	public IPage<Location> selectList(LocationRequest request, Page<Location> page){
	    LambdaQueryWrapper<Location> lambdaQueryWrapper = new LambdaQueryWrapper<>();
	    
	    if (null != request.getId()) {
	       lambdaQueryWrapper.eq(Location::getId, request.getId());
	      }
		if (StringUtils.hasText(request.getLocationName())) {
			lambdaQueryWrapper.like(Location::getLocationName, request.getLocationName());
		}
		if (StringUtils.hasText(request.getLocationNumber())) {
			lambdaQueryWrapper.like(Location::getLocationNumber, request.getLocationNumber());
		}
		if (StringUtils.hasText(request.getStockNo())) {
			lambdaQueryWrapper.like(Location::getStockNo, request.getStockNo());
		}
        
		lambdaQueryWrapper.orderByDesc(Location::getId);	
		Page<Location> selectPage = this.baseMapper.selectPage(page, lambdaQueryWrapper);
		return selectPage;
    }
        
    
	
}